YAHOO.util.Event.addListener(window, "load", function(){
    var loader = new YAHOO.util.YUILoader();
    loader.addModule({
        name: "jquery",
        type: "js",
        fullpath: "/html/scripts/jquery.js",
        varName: "jquery",
        requires: ['container']
    });
    loader.addModule({
        name: "validate",
        type: "js",
        fullpath: "/html/scripts/jquery.validate.js",
        varName: "validate",
        requires: ['jquery']
    });
    loader.base = '/html/yui/build/';
    loader.loadOptional = true;
    loader.onSuccess = init;
    loader.require(['container','jquery','validate']);
    loader.insert();
})
YAHOO.namespace("example.container");

function init(){
    // Build overlay1 based on markup, initially hidden, fixed to the center of the viewport, and 300px wide
    YAHOO.example.container.overlay1 = new YAHOO.widget.Overlay("overlay1", {
        fixedcenter: true,
        visible: false,
        width: "350px"
    });
    YAHOO.example.container.overlay1.render();
    YAHOO.example.container.overlay1.show();
    
    $("#login").validate({
        rules: {
            userName: {
                required: true
            },
            passWord: {
                required: true
            }
        },
        messages: {
            userName: {
                required: "请输入姓名!"
            },
            passWord: {
                required: "请输入密码!"
            }
        }
    });
}

